import { createStore } from 'vuex'
import login from './login/login'
import createPersistedState from 'vuex-persistedstate'
const state = {}
const getters = {}
const mutations = {}
const actions = {}
const modules = {
  login
}
const index = createStore({
  state,
  getters,
  mutations,
  actions,
  modules,
  plugins: [createPersistedState({
    storage: window.sessionStorage,
    reducer (val) {
      const { user } = val.login
      return {
        // 只储存state中的user
        user: user
      }
    }
  })]
})
export default index
